<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
        }
        div, span{
            width: 100px;
            height: 100px;
            border: solid;
        }

        /* 块元素对同一个位置设置外补白取大的那个值 */
        .d1{
            margin-bottom: 10px;
        }
        .d2{
            margin-top: 20px;
        }

        /* 行元素对同一个位置设置外补白叠加显示 */
        .s1{
            margin-right: 10px;
        }
        .s2{
            margin-left: 20px;
        }
    </style>
</head>
<body>
    <div class="d1">1</div>
    <div class="d2">2</div>
    <span class="s1">hello</span>
    <span class="s2">hello</span>
</body>
</html>